home *** CD-ROM | disk | FTP | other *** search
/ Freelog 38 / Freelog038.iso / Bas / Bureautique / Ntl480 / Setup.exe / {app} / Libraries / FTP.clb < prev    next >
Text File  |  2002-06-10  |  14KB  |  412 lines

  1. = V5 MultiLine NoSorting TabWidth=30
  2.  
  3. H=";FTP Utilities"
  4. The Clips under this section use the Windows FTP.exe program. If the FTP program is not installed on your computer, you will not be able to run the Clips.
  5.  
  6. * FTP server setup:
  7. Use this Clip to set the parameters of the remote server you want to connect to. It is automatically called by the other Clips if no remote server was defined.
  8.  
  9. * Download files:
  10. Use this Clip to download one or more files from the specified remote computer. You can choose the folder where files should be downloaded to, the remote folder containing the files, the type of transfer (use Binary for .zip, .exe, and image files; use Text for Web pages and other text files), and the names of the files to download (each name, which may contain wildcards, must be entered on a separate line). Note that you should use forward slashes instead of backslashes when specifying a remote path with multiple directories. If you are downloading text files, NoteTab will offer to open the files for you once the FTP operation is over.
  11.  
  12. * Upload files:
  13. Use this Clip to upload one or more files from your computer to the specified remote server. You can choose the remote folder where files should be downloaded to, the local folder containing your files, the type of transfer (use Binary for .zip, .exe, and image files; use Text for Web pages and other text files), and the names of the files to download (each name, which may contain wildcards, must be entered on a separate line). Note that you should use forward slashes instead of backslashes when specifying a remote path with multiple directories.
  14.  
  15. * Delete FTP files:
  16. Use this Clip to delete one or more files from the specified remote server. You can choose the remote folder which contains your files, and the names of the files to delete (each name, which may contain wildcards, must be entered on a separate line). Note that you should use forward slashes instead of backslashes when specifying a remote path with multiple directories. Use this command with care are you cannot "undo" this operation.
  17.  
  18. * Open FTP document:
  19. Use this Clip to open a remote document in NoteTab. You can specify the path with the filename (e.g. homepage/html/index.htm). The Clip will download the remote file into the Windows temporary folder and open it in NoteTab. Note that you cannot use this method to simultaneously edit two files with the same name (from different remote directories).
  20.  
  21. * Save FTP document:
  22. Saves the current NoteTab document to the remote server. You can specify the remote directory that should receive the file (leave it blank to save to the root directory).
  23.  
  24.  
  25.  
  26. H="FTP server setup"
  27. ^!Set %ScriptName%=^$GetShort(^$GetTempFile$)$
  28. ^!Set %Command%=^$GetSysProgPath$FTP.exe
  29. ^!IfFileExist "^%Command%" Next ELSE NoFTP
  30.  
  31. ^!Set %Computer%=^$GetValue("FTP:Computer")$; %UserName%=^$GetValue("FTP:UserName")$; %Password%=^$GetValue("FTP:Password")$; %SavePassword%=^$GetValue("FTP:SavePassword")$; %CaptureOutput%=^$GetValue("FTP:CaptureOutput")$
  32. ^!IfTrue ^$IsEmpty("^%UserName%")$ ^!Set %UserName%=anonymous
  33. ^!IfTrue ^$IsEmpty("^%Password%")$ ^!Set %Password%=yourname@domain.com
  34. ^!IfTrue ^$IsEmpty("^%SavePassword%")$ ^!Set %SavePassword%=No
  35. ^!Set %DefSavePw%=^$SetDefaultValue(Yes|_No;^%SavePassword%)$
  36. ^!IfTrue ^$IsEmpty("^%CaptureOutput%")$ ^!Set %CaptureOutput%=No
  37. ^!Set %DefCapture%=^$SetDefaultValue(Yes|_No;^%CaptureOutput%)$
  38.  
  39. ^!Set %Command%=^%Command% -i -s:^%ScriptName%; %Computer%=^?{Name/IP address=^%Computer%}; %UserName%=^?{Login user name=^%UserName%}; %Password%=^?{Login password=^%Password%}; %SavePassword%=^?{Remember password?=^%DefSavePw%}; %CaptureOutput%=^?{Capture FTP messages?=^%DefCapture%}
  40.  
  41. ^!SaveValue FTP:Computer=^%Computer%
  42. ^!SaveValue FTP:UserName=^%UserName%
  43. ^!SaveValue FTP:SavePassword=^%SavePassword%
  44. ^!SaveValue FTP:CaptureOutput=^%CaptureOutput%
  45. ^!Set %KeepPassword%=^%Password%
  46. ^!IfFalse ^%SavePassword% ^!ClearVariable %KeepPassword%
  47. ^!SaveValue FTP:Password=^%KeepPassword%
  48.  
  49. ^!Goto End
  50.  
  51. :NoFTP
  52. ^!Prompt The Windows FTP.exe program was not found on your computer. Please install it before using this command.
  53. ^!Goto Exit
  54.  
  55.  
  56. H=";"
  57.  
  58.  
  59. H="Download files"
  60. ^!IfTrue ^$IsEmpty("^%Computer%")$ ^!Clip "FTP server setup"
  61. ^!Clip "Set default folders"
  62.  
  63. ^!Set %FileType%=^?{File type==_Text^=ascii|Binary^=binary}; %LocalFolder%=^?{(T=D)Download files to which folder?=^%LocalFolder%}; %RemoteFolder%=^?{Remote folder name=^%RemoteFolder%}; %List%=^?{(T=M)Files to download (one per line)}
  64.  
  65. ^!Clip "FormatList" get
  66. ^!Clip "Folder setup"
  67. ^!Clip "Run FTP"
  68.  
  69. ^!If ^$StrPos(binary;"%FileType%";False)$ > 0 End
  70. ^!IfFalse ^?{Open downloaded files in NoteTab?==_Yes|No} End
  71. ^!Open ^%OpenList%
  72.  
  73.  
  74. H="Upload files"
  75. ^!IfTrue ^$IsEmpty("^%Computer%")$ ^!Clip "FTP server setup"
  76. ^!Clip "Set default folders"
  77.  
  78. ^!Set %FileType%=^?{File type==_Text^=ascii|Binary^=binary}; %LocalFolder%=^?{(T=D)Local folder with files to upload=^%LocalFolder%}; %RemoteFolder%=^?{Upload files to which remote folder?=^%RemoteFolder%}; %List%=^?{(T=M)Files to upload (one per line)}
  79.  
  80. ^!Clip "FormatList" put
  81. ^!Clip "Folder setup"
  82. ^!Clip "Run FTP"
  83.  
  84.  
  85. H="Delete FTP files"
  86. ^!IfTrue ^$IsEmpty("^%Computer%")$ ^!Clip "FTP server setup"
  87. ^!Clip "Set default folders"
  88.  
  89. ^!Set %RemoteFolder%=^?{Remote folder containing files to delete?=^%RemoteFolder%}; %List%=^?{(T=M)Files to delete (one per line)}
  90.  
  91. ^!Clip "FormatList" delete
  92. ^!Clip "Folder setup" IgnoreLocal
  93. ^!Clip "Run FTP"
  94.  
  95.  
  96. H=";"
  97.  
  98.  
  99. H="Open FTP document"
  100. ;^!SetDebug On
  101. ^!IfTrue ^$IsEmpty("^%Computer%")$ ^!Clip "FTP server setup"
  102. ^!Clip "Set default folders"
  103.  
  104. ^!Set %FileType%=ascii; %LocalFolder%=^$GetTmpPath$; %FileName%=^?{FTP Document to open}
  105. ^!Set %FileName%=^$StrReplace("\";"/";"^%FileName%";True;False)$
  106. ^!Set %P%=^$StrPosRight("/";"^%FileName%";True)$
  107. ^!Set %RemoteFolder%=^$StrCopy("^%FileName%";1;^$Calc(^%P%-1)$)$
  108. ^!Set %FileName%=^$StrDelete("^%FileName%";1;^%P%)$
  109.  
  110. ^!Set %OpenList%=^%LocalFolder%^$GetFileName(^%FileName%)$
  111. ^!Set %List%=get ^%FileName%^%NL%
  112.  
  113. ^!Clip "Folder setup" IgnoreLocal
  114. ^!Clip "Run FTP"
  115.  
  116. ^!Open ^%OpenList%
  117.  
  118.  
  119. H="Save FTP document"
  120. ^!IfTrue ^$IsEmpty("^%Computer%")$ ^!Clip "FTP server setup"
  121. ^!Clip "Set default folders"
  122.  
  123. ^!Save
  124. ^!Set %FullName%=^$GetDocName$
  125. ^!Set %FileType%=ascii; %LocalFolder%=^$GetPath(^%FullName%)$; %RemoteFolder%=^?{Remote folder name=^%RemoteFolder%}; %FileName%=^$GetFileName(^%FullName%)$
  126.  
  127. ^!Set %List%=put ^%FileName%^%NL%
  128.  
  129. ^!Clip "Folder setup" IgnoreLocal
  130. ^!Clip "Run FTP"
  131. ^!Continue Send local copy of ^%FileName% to Recycle Bin?
  132. ^!DestroyDoc ^%FullName%
  133.  
  134. H=";"
  135.  
  136.  
  137. H=";For Advanced Users"
  138. The Clips under this section are only recommended for advanced users who know how to use FTP commands.
  139.  
  140. * Create FTP script:
  141. Opens the FTP.tpl template file. You can use the Clips under the "FTP Script Commands" section to build your script file.
  142.  
  143. * Run FTP program:
  144. This Clip opens a wizard that lets you setup the FTP.exe program through the command line. The program is run once you click on the OK button.
  145.  
  146.  
  147. H="Create FTP script"
  148. ^!Open ^$GetTemplatePath$FTP.tpl
  149.  
  150. H="Run FTP program"
  151. ^!Set %CommandLine%=^$GetSysProgPath$FTP.exe
  152. ^!IfFileExist "^%CommandLine%" Next ELSE NoFTP
  153.  
  154. ^!Set %Host%=^$GetValue("FTP:Host")$
  155. ^!Set %ScriptName%=^$GetValue("FTP:ScriptName")$
  156. ^!Set %BufferSize%=^$GetValue("FTP:BufferSize")$
  157. ^!IfTrue ^$IsEmpty("^%ScriptName%")$ ^!Set %ScriptName%=^$GetScriptPath$
  158. ^!IfTrue ^$IsEmpty("^%BufferSize%")$ ^!Set %BufferSize%=4096
  159.  
  160. ^!SetListDelimiter " "
  161. ^!Set %Host%=^?{Name or IP of remote computer (optional)=^%Host%}; %ScriptName%=^?{(T=O;F="Script files (*.scr;*.txt)|*.scr;*.txt")FTP Script file (optional)=^%ScriptName%}; %BufferSize%=^?{Transfer buffer size in bytes (optional)=^%BufferSize%}; %Options%=^?{(T=A;H=5)Command-Line options=Surpress display of remote server responses^=-v|Surpress auto-login upon initial connection^=-n|_Turn off interactive prompting during multiple file transfers^=-i|Enable debugging (displays all FTP commands)^=-d|Disable filename globbing (disables use of wildcards)^=-g}
  162.  
  163. ^!IfSame "^%BufferSize%" "4096" ^!ClearVariable %BufferSize%
  164.  
  165. ^!SaveValue FTP:Host=^%Host%
  166. ^!SaveValue FTP:ScriptName=^%ScriptName%
  167. ^!SaveValue FTP:BufferSize=^%BufferSize%
  168.  
  169. ^!IfFalse ^$IsEmpty("^%Host%")$ ^!Set %Host%= ^%Host%
  170. ^!IfFalse ^$IsEmpty("^%ScriptName%")$ ^!Set %ScriptName%= -s:^$GetShort("^%ScriptName%")$
  171. ^!IfFalse ^$IsEmpty("^%BufferSize%")$ ^!Set %BufferSize%= -w:^%BufferSize%
  172. ^!IfFalse ^$IsEmpty("^%Options%")$ ^!Set %Options%= ^%Options%
  173.  
  174. ^!^%CommandLine%^%Options%^%ScriptName%^%BufferSize%^%Host%
  175. ^!Goto End
  176.  
  177. :NoFTP
  178. ^!Prompt The Windows FTP.exe program was not found on your computer. Please install it before using this command.
  179. ^!Goto Exit
  180.  
  181.  
  182. H=";"
  183.  
  184.  
  185. H=";FTP Script Commands"
  186. The Clips under this topic are useful to create script files that can be used by the Windows FTP program.
  187.  
  188. H="append"
  189. ;append to a file
  190. append 
  191.  
  192. H="ascii"
  193. ;set ascii transfer type
  194. ascii
  195.  
  196. H="bell"
  197. ;beep when command completed
  198. bell
  199.  
  200. H="binary"
  201. ;set binary transfer type
  202. binary
  203.  
  204. H="bye"
  205. ;terminate ftp session and exit
  206. bye
  207.  
  208. H="cd"
  209. ;change remote working directory
  210. cd ^?[Change remote working directory]
  211.  
  212. H="close"
  213. ;terminate ftp session
  214. close
  215.  
  216. H="debug"
  217. ;toggle debugging mode
  218. debug
  219.  
  220. H="delete"
  221. ;delete remote file
  222. delete ^?[Remote file name to delete]
  223.  
  224. H="dir"
  225. ;list contents of remote directory
  226. dir ^?[Directory name to list (leave blank for working dir)]
  227.  
  228. H="disconnect"
  229. ;terminate ftp session
  230. disconnect
  231.  
  232. H="get"
  233. ;receive file
  234. get ^?[Remote file name to download] ^?[Local name (leave blank if same)]
  235.  
  236. H="glob"
  237. ;toggle metacharacter expansion of local file names
  238. glob
  239.  
  240. H="hash"
  241. ;toggle printing `#' for each buffer transferred
  242. hash
  243.  
  244. H="help"
  245. ;print local help information
  246. help
  247.  
  248. H="lcd"
  249. ;change local working directory
  250. lcd ^?[Change local working directory]
  251.  
  252. H="literal"
  253. ;send arbitrary ftp command
  254. literal ^?[FTP command]
  255.  
  256. H="ls"
  257. ;list contents of remote directory
  258. ls ^?[Directory name to list (leave blank for working dir)]
  259.  
  260. H="mdelete"
  261. ;delete multiple files
  262. mdelete  ^?[Remote file name to delete (accepts wildcards)]
  263.  
  264. H="mdir"
  265. ;list contents of multiple remote directories
  266. mdir ^?[Directory names to list]
  267.  
  268. H="mget"
  269. ;get multiple files
  270. mget ^?[Remote file name to download (accepts wildcards)]
  271.  
  272. H="mkdir"
  273. ;make directory on the remote machine
  274. mkdir ^?[Remote directory to make]
  275.  
  276. H="mls"
  277. ;list contents of multiple remote directories
  278. mls ^?[Directory names to list]
  279.  
  280. H="mput"
  281. ;send multiple files
  282. mput ^?[Local file name to upload(accepts wildcards)]
  283.  
  284. H="open"
  285. ;connect to remote tftp
  286. open ^?[Address of remote server]
  287.  
  288. H="prompt"
  289. ;force interactive prompting on multiple commands
  290. prompt
  291.  
  292. H="put"
  293. ;send one file
  294. put ^?[Local file name to upload] ^?[Remote name (leave blank if same)]
  295.  
  296. H="pwd"
  297. ;print working directory on remote machine
  298. pwd ^?[Login password]
  299.  
  300. H="quit"
  301. ;terminate ftp session and exit
  302. quit
  303.  
  304. H="quote"
  305. ;send arbitrary ftp command
  306. quote
  307.  
  308. H="recv"
  309. ;receive file
  310. recv ^?[Remote file name to download] ^?[Local name (leave blank if same)]
  311.  
  312. H="remotehelp"
  313. ;get help from remote server
  314. remotehelp
  315.  
  316. H="rename"
  317. ;rename file
  318. rename ^?[File to rename] ^?[New name]
  319.  
  320. H="rmdir"
  321. ;remove directory on the remote machine
  322. rmdir ^?[Remote directory to remove]
  323.  
  324. H="send"
  325. ;send one file
  326. send ^?[Local file name to upload] ^?[Remote name (leave blank if same)]
  327.  
  328. H="status"
  329. ;show current status
  330. status
  331.  
  332. H="trace"
  333. ;toggle packet tracing
  334. trace
  335.  
  336. H="type"
  337. ;set file transfer type
  338. type 
  339.  
  340. H="user"
  341. ;send new user information
  342. user ^?[Login user name]
  343.  
  344. H="verbose"
  345. ;toggle verbose mode
  346. verbose
  347.  
  348.  
  349. H=";"
  350.  
  351.  
  352. H="_FormatList"
  353. ^!SetListDelimiter ^p
  354. ^!SetArray %Files%=^%List%
  355. ^!ClearVariable %List%
  356. ^!ClearVariable %OpenList%
  357. ^!Set %Index%=0
  358.  
  359. :StartLoop
  360. ^!Inc %Index%
  361. ^!If ^%Index% > ^%Files0% EndLoop
  362. ^!Set %FileName%=^%Files^%Index%%
  363. ^!IfTrue ^$IsEmpty("^%FileName%")$ StartLoop
  364. ^!ClearVariable %Prefix%
  365. ^!IfTrue ^$IsWildcard("^%FileName%")$ > 0 ^!Set %Prefix%=m
  366. ^!Append %OpenList%="^%LocalFolder%^$GetFileName(^%FileName%)$";
  367. ^!Set %FileName%=^%Prefix%^& ^%FileName%^%NL%
  368. ^!Append %List%=^%FileName%
  369. ^!Goto StartLoop
  370.  
  371. :EndLoop
  372. ^!IfTrue ^$IsEmpty("^%List%")$ NoFiles
  373. ^!Goto End
  374.  
  375. :NoFiles
  376. ^!Prompt No files specified. FTP operation ended.
  377. ^!Goto Exit
  378.  
  379.  
  380. H="_Set default folders"
  381. ^!Set %LocalFolder%=^$GetValue("FTP:LocalFolder")$; %RemoteFolder%=^$GetValue("FTP:RemoteFolder")$
  382. ^!IfTrue ^$IsEmpty("^%LocalFolder%")$ ^!Set %LocalFolder%=^$GetDocumentPath$FTP
  383.  
  384.  
  385. H="_Folder setup"
  386. ^!IfSame "^&" "IgnoreLocal" Skip
  387. ^!SaveValue FTP:LocalFolder=^%LocalFolder%
  388. ^!SaveValue FTP:RemoteFolder=^%RemoteFolder%
  389.  
  390. ^!IfPathExist ^%LocalFolder% Skip
  391. ^!MkDir ^%LocalFolder%
  392. ^!ChDir ^%LocalFolder%
  393.  
  394. ^!IfFalse ^$IsEmpty("^%RemoteFolder%")$ ^!Set %RemoteFolder%=cd ^%RemoteFolder%^%NL%
  395.  
  396.  
  397. H="_Run FTP"
  398. ^!TextToFile "^%ScriptName%" open ^%Computer%^%NL%^%UserName%^%NL%^%Password%^%NL%^%RemoteFolder%^%FileType%^%NL%^%List%quit
  399.  
  400. ^!IfTrue ^%CaptureOutput% CaptureMessages
  401.  
  402. ^!ShellWait ^%Command%
  403. ^!DeleteFile ^%ScriptName%
  404. ^!Goto End
  405.  
  406. :CaptureMessages
  407. ^!Set %Output%=^$GetOutput("^%Command%")$
  408. ^!DeleteFile ^%ScriptName%
  409. ^!ToolBar New Document
  410. ^!SetWordWrap Off
  411. ^!InsertText ^%Output%
  412. ^!ClearVariable %Output%